package de.tum.in.eist.poll.client.controllers;

import com.google.gwt.user.client.rpc.AsyncCallback;

import de.tum.in.eist.poll.client.DelayedAction;
import de.tum.in.eist.poll.shared.beans.Feedback;

/**
 * PollController
 * @author Sebastian Hofstetter
 *
 */
public class PollController extends Controller {
	/**
	 * submits Feedback to the currently selected lecture
	 * @param feedback
	 */
	public void submitFeedback(Feedback feedback) {
		// sets that the user has submitted
		Controller.controller.setHasSubmitted(true, new DelayedAction() {

			@Override
			public void run() {
				Controller.controller.refreshPage();
			}
			
		});
		
		// submits the feedback to the server
		pollService.submitFeedback(feedback, new AsyncCallback<String>() {

			@Override
			public void onFailure(Throwable caught) {}

			@Override
			public void onSuccess(String result) {}
		});
	}
}
